//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//   PACKAGE   : dcf
//   FILE      : SubscriberListMessage.java
//   CLASS     : SubscriberListMessage
//   DATE      : 2006-04-01
//   
//   DESCRIPTION
//   The SubscriberListMessage class is the message sent from the LocatorService to a publisher of a service 
//   that identifies a collection of subscribers waiting for the service to be publisherd prior to the publisher
//   registering.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//   Copyright (c) 2006 by Hal Smith
//
//   Permission is hereby granted, free of charge, to any person obtaining a copy of this source code 
//   (the "Code")to deal with the Code without restriction, including without limitation the rights to use, copy,
//   modify, merge, publish and distribute the Code, and to permit persons to whom the Code is furnished to do 
//   so, subject to the following conditions:
//
//   The above copyright notice and this permission notice shall be included in all copies or substantial 
//   portions of the Software.
//   
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//   VERSION HISTORY
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package dcf;

class SubscriberListMessage extends Message {
	
	
	// The list of subscribers.
	//
	private SubscriberList subscribers;
	
	
	// Constructor.
	//
	// This operaton initializes the subscriber list message. There are no exceptions thrown from this 
	// operation.
	//
	public SubscriberListMessage(SubscriberList initSubscribers) throws InitializationException {
		
		// If either of the supplied parameters are null, log an error and throw an InitializationException.
		// Otherwise, save off the necessary data locally.
		//
		if (initSubscribers == null) {
			
			System.out.println("SubscriberListMessage.SubscriberListMessage(initSubscribers):");
			System.out.println("   Subscriber list supplied cannot be null.");
			
			throw new InitializationException();
			
		} else {
			
			subscribers = initSubscribers;
			
		}
	
	}
	
	
	// This operation returns the list of subscribers.
	//
	public SubscriberList getSubscribers() {
		return subscribers;
	}
	
	// This operation returns the service to which the list of subscribes wants to 
	// be subscribed.
	//
	public String getServiceName() {
		return subscribers.getSubscriber(0).getServiceName();
	}

}
